/* vim: set ts=2 et sw=2 cindent fo=qroca: */

package com.globant.google.mendoza.malbec.transport;

import java.util.Properties;

/** A listener of the Transport that is notified when a new message is
 * received.
 *
 * This interface must be implemented by the client and register in the
 * Transport.
 *
 * The transport first calls received to get the message acknowledge, and then
 * it calls received to allow clients to post-process the message.
 */
public interface Receiver {

  /** Receives a message from GBuy.
   *
   * @param message The message received. It cannot be null.
   *
   * @return Returns the server response to send to GBuy, usually an
   * acknowledge or an error related to the validity of the message structure.
   */
  String receive(final String uri, final String method, final Properties
      header, final Properties parameters, final String message);

  /** Receives a message from GBuy to allow for post processing after
   * acknowledging the notification.
   *
   * @param message The message received. It cannot be null.
   */
  void received(final String message);
}

